home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Messaging Service Access Module / Internet PMSAM / Internet PMSAM source / trapavailable.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-19  |  1.4 KB  |  73 lines  |  [TEXT/MPS ]

  1. /*-------------------------------------------------------------------
  2.  
  3. AOCE Post Office Protocol (POP) / Simple Mail Transfer Protocol (SMTP)
  4. Mail Service Access Module
  5.  
  6. written by Steve Falkenburg-- MacDTS
  7. ©1991-1993 Apple Computer, Inc.
  8.  
  9. --------------
  10. change history
  11. --------------
  12.  
  13. SJF        02/19/93    update for beta build    b1
  14. SJF        10/29/92    update to a11            a11
  15. SJF        06/08/92    update to a8            a8
  16. SJF        02/15/92    first working version    a4.5
  17. SJF        10/16/91    initial coding            a3
  18.  
  19. ---------------------------------------------------------------------*/
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25. #ifndef __TRAPS__
  26. #include <Traps.h>
  27. #endif
  28.  
  29. #ifndef __OSUTILS__
  30. #include <OSUtils.h>
  31. #endif
  32.  
  33. #ifndef __GESTALTEQU__
  34. #include <GestaltEqu.h>
  35. #endif
  36.  
  37. #include "trapavailable.h"
  38.  
  39. short NumToolboxTraps(void);
  40. TrapType GetTrapType(short theTrap);
  41.     
  42. short NumToolboxTraps(void)
  43. {
  44.     if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E,ToolTrap))
  45.         return 0x0200;
  46.     else
  47.         return 0x0400;
  48. }
  49.  
  50. TrapType GetTrapType(short theTrap)
  51. {
  52.     if ((theTrap & 0x0800) > 0)
  53.         return ToolTrap;
  54.     else
  55.         return OSTrap;
  56. }
  57.  
  58. Boolean    TrapAvailable(short theTrap)
  59. {
  60.     TrapType tType;
  61.     Boolean isAvail;
  62.     
  63.     tType = GetTrapType(theTrap);
  64.     if (tType == ToolTrap)
  65.         {
  66.             theTrap &= 0x07FF;
  67.             if (theTrap >= NumToolboxTraps())
  68.                 theTrap = _Unimplemented;
  69.         }
  70.     
  71.     isAvail = NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap);
  72.     return isAvail;
  73. }